Sample Printer Delivery Extension

© Copyright Microsoft Corporation, 2003. All rights reserved.

 
The SQL Server documentation team cannot answer technical support questions, but welcomes your suggestions and comments about this readme documentation. You can quickly and directly send e-mail feedback using the link below. All feedback must be in English. To submit written feedback about this document, click here:  Submit feedback.
 

This document contains the release information for the Reporting Services PrinterDeliverySample extension. The following sections are included in this Readme:

Overview

PrinterDeliverySample offers an introduction on how to write a custom delivery extension. The sample delivers reports to a printer using Reporting Services' delivery API. This sample features the use of the IMAGE rendering extension along with the System.Drawing namespace in the .NET Framework.

Topics

The following bullets briefly describe the classes and technologies used by this sample.

Location

The sample code files are located in the Extensions\PrinterDeliverySample subdirectory of the Reporting Services samples directory.

For Example:

C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\Samples\Extensions\PrinterDeliverySample

Building and deploying the sample

In order to properly build and run this sample, the following steps need to be performed.

To build the sample using the .NET Framework SDK

  1. Copy Microsoft.ReportingServices.Interfaces.dll from the report server \bin directory into your sample folder. By default, Microsoft.ReportingServices.Interfaces.dll is located in C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin of the computer running report server.

  2. Issue the following command to create the sample delivery extension Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll.
    csc /t:library /out:Microsoft.Samples.ReportingServices.PrinterDelivery.dll *.cs /r:Microsoft.ReportingServices.Interfaces.dll
    

To build the sample using Visual Studio .NET

  1. Open PrinterDeliverySample.sln in Visual Studio .NET.

  2. In Solution Explorer, select the PrinterDeliverySample project.

  3. On the Project menu, choose Add Reference.

    The Add References dialog box opens.

  4. Choose the .NET tab.

  5. Choose Browse, and find Microsoft.ReportingServices.Interfaces.dll on your local drive. By default, the assembly is located in C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin. Click OK.

    The selected reference is added to your project.

  6. From the Build menu, choose Build Solution.

After you have completed the previous steps, Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll can then be deployed to a report server and to Report Manager for use in delivering reports.

To deploy the sample

  1. Copy Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll to the report server. The default location for report server extensions is C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin.

  2. In the RSReportServer.config file, make the following entry under the Delivery element.
    <Extension Name="Printer Delivery Sample" Type="Microsoft.Samples.ReportingServices.PrinterDeliverySample.PrinterDeliveryProvider,Microsoft.Samples.ReportingServices.PrinterDeliverySample">
       <Configuration>
          <Printers>
             <Printer>\\Server\MyNetworkPrinter1</Printer>
             <Printer>\\Server\MyNetworkPrinter2</Printer>
             <Printer>MyLocalPrinter</Printer>
          </Printers>
       </Configuration>
    </Extension>
    

    NOTE: The Printers element is designed to enable a fixed set of printer names to be available for the delivery extension Printer setting. This list is ultimately checked against the known list of available printers on the report server to which the delivery extension is installed. If a selected printer does not match the known list of installed printers on the report server, the delivery fails with status, "The printer {0} is not currently installed on the server."

  3. Copy the assembly to Report Manager. The default location for extensions for Report Manager is C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportManager\bin.

  4. In the RSWebApplication.config file, make the following entry under the DeliveryUI element:
    <Extension Name="Printer Delivery Sample" Type="Microsoft.Samples.ReportingServices.PrinterDeliverySample.PrinterDeliveryUIProvider,Microsoft.Samples.ReportingServices.PrinterDeliverySample"/>
    

To configure code access security for the sample

  1. Open the report server policy configuration file (rssrvpolicy.config). The default location for this file is C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer.

  2. Delivery extensions must be granted full trust, therefore, add the following code group information to the configuration file:
    <CodeGroup class="UnionCodeGroup"
       version="1"
       PermissionSetName="FullTrust"
       Name="PrinterDeliveryCodeGroup"
       Description="Code group for my delivery extension">
          <IMembershipCondition class="UrlMembershipCondition"
             version="1"
             Url="C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin\Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll"
           />
    </CodeGroup>
  3. If you are using the sample printer delivery extension in Report Manager, repeat steps 1 and 2 using the Report Manager policy configuration file (rsmgrpolicy.config) and the following code group:
    <CodeGroup class="UnionCodeGroup"
       version="1"
       PermissionSetName="FullTrust"
       Name="PrinterDeliveryCodeGroup"
       Description="Code group for my delivery extension">
          <IMembershipCondition class="UrlMembershipCondition"
             version="1"
             Url="C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportManager\bin\Microsoft.Samples.ReportingServices.PrinterDeliverySample.dll"
           />
    </CodeGroup>

    The default location for the rsmgrpolicy.config file is C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportManager.

Notes

For information about implementing a Reporting Services delivery extension, see "Implementing a Delivery Extension" in Reporting Services Books Online.